<HTML>
	<TITLE>Workflow.NET
		<%#actionname%>
		-<%#propertyname%></TITLE>
	<STYLE><%#stylesheet%>
	</STYLE>
	<BODY marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">
		<form name="wf_theform" method="post">
			<TABLE width="<%#width%>" height="<%#height%>" bgcolor="<%#bgcolor%>" cellspacing="0" cellpadding="0" border="0">
				<TR>
					<TD valign="top" height="260">
						<TABLE>
							<TR>
								<TD valign="top">
									<IFRAME name="frame_preview" src="<%#requeststring%>&amp;pagesection=previewframe&amp;_mode=#_mode#" STYLE="WIDTH:490px;HEIGHT:250px">
									</IFRAME>
								</TD>
							</TR>
						</TABLE>
					</TD>
				</TR>
				<TR>
					<TD height="1" bgcolor="black"><IMG src="?drawimage=spacer.gif" height="1" width="1"></TD>
				</TR>
				<TR>
					<TD height="1" bgcolor="white"><IMG src="?drawimage=spacer.gif" height="1" width="1"></TD>
				</TR>
				<TR>
					<TD align="center" height="100">
						<TABLE border="0" width="80%">
							<TR>
								<TD colspan="2">
									<B>To add new input values please provide the following information and click on
										the Add New button below</B>
								</TD>
							</TR>
							<TR>
								<TD>
									No. of additional questions
								</TD>
								<TD>
									<input type="textbox" class="inputs" name="txtaddinputs" value="1" style="WIDTH:40px">
								</TD>
							</TR>
						</TABLE>
					</TD>
				</TR>
				<TR>
					<TD height="1" bgcolor="black"><IMG src="?drawimage=spacer.gif" height="1" width="1"></TD>
				</TR>
				<TR>
					<TD height="1" bgcolor="white"><IMG src="?drawimage=spacer.gif" height="1" width="1"></TD>
				</TR>
				<TR>
					<TD align="right" height="30">
						<input type="button" class="buttons" value="Add New" name="btnaddnew" onclick="addnew(document.wf_theform.txtaddinputs.value )">
						<input type="button" class="buttons" value="Modify" name="btnmodify" onclick="modify('page1')">
						<input type="button" class="buttons" value="Delete" name="btndelete" onclick="remove()">&nbsp;&nbsp;
						<input type="button" class="buttons" value="Close" ID="btnCancel" onclick="window.close();"
							NAME="btnCancel">
					</TD>
				</TR>
			</TABLE>
			<input type="hidden" name="_hidtempstore" id="_hidtempstore"> <input type="hidden" name="_mode" ID="_mode">
			<input type="hidden" name="_pageinfo" id="_pageinfo">
		</form>
		<SCRIPT>
	var mandatory="<%#mandatoryvalue%>";
	function modify(pageinfo)
	{
		var returnvalue=getselectedvalues();
		if (returnvalue.length>0)
		{
			document.wf_theform._mode.value='modify';
			document.wf_theform._pageinfo.value = pageinfo;
			document.wf_theform._hidtempstore.value=returnvalue;
			document.wf_theform.submit()
		}
		else
		{
			alert("Please check the boxes against the questions you wish to Modify.");
		}

	}

	function addnew(tempstore)
	{
		if (isNaN(document.wf_theform.txtaddinputs.value)|| parseInt(document.wf_theform.txtaddinputs.value)==0)
		{
			alert("Incorrect entry. No. of additional questions should be a numeric value and greater than 0");
			document.wf_theform.txtaddinputs.focus();
			return ;
		}
		document.wf_theform._mode.value='addnew';
		document.wf_theform._pageinfo.value = 'page1';
		document.wf_theform._hidtempstore.value=tempstore;
		document.wf_theform.submit()
	}

	function remove()
	{
		var returnvalue=getselectedvalues();
		if (returnvalue.length>0)
		{
			document.wf_theform._mode.value='remove';
			document.wf_theform._hidtempstore.value=returnvalue;
			document.wf_theform.submit()
		}
		else
		{
			alert("Please check the boxes against the questions you wish to Delete.");
		}
	}
	function getTotalCount()
		{
			var returnvalue="";
			var i=0;
			var obj = eval("frame_preview");
			var tempobj;
			var d = obj.document
			return parseInt(d.wf_theform.questioncount.value)
		}
	function getSelectedCount()
		{
			var selectedCount=0;
			var i=0;
			var obj = eval("frame_preview");
			var tempobj;
			var d = obj.document
			if (parseInt(d.wf_theform.questioncount.value)> 0 )
					{
						tempobj = eval("d.wf_theform.wf_selection")
						for ( i = 0 ;i<parseInt(d.wf_theform.questioncount.value);i++)
						{
							if (parseInt(d.wf_theform.questioncount.value) ==1)
							{
								if (tempobj.checked)
									selectedCount++;
							}
							else if (tempobj[i].checked)
							{
								selectedCount++;
							}
						}
					}

					return selectedCount;

		}
	function getselectedvalues()
	{
		var returnvalue="";
		var i=0;
		var obj = eval("frame_preview");
		var tempobj;
		var d = obj.document
		if (parseInt(d.wf_theform.questioncount.value)> 0 )
		{
			tempobj = eval("d.wf_theform.wf_selection")
			for ( i = 0 ;i<parseInt(d.wf_theform.questioncount.value);i++)
			{
				if (parseInt(d.wf_theform.questioncount.value) ==1)
				{
					if (tempobj.checked)
						returnvalue += "#" + tempobj.value;
				}
				else if (tempobj[i].checked)
				{
					returnvalue += "#" + tempobj[i].value
				}
			}
		}
		if (returnvalue.length > 0)
			returnvalue = returnvalue.substring(1,returnvalue.length)

		return 	returnvalue;
	}

		</SCRIPT>
	</BODY>
</HTML>
